package com.ikas.autumn.iec104.module.iec.netty;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

/**
 * 104主从站的基类
 * @author wu.yunfeng
 * @version 3.0
 */
@Slf4j
@NoArgsConstructor
public class BaseProtocolBuilder {

	/**
	 * Builder id
	 */
	@Getter
	protected String builderId = UUID.randomUUID().toString();

	/**
	 * Config info map
	 */
	@Getter
	protected Map<String, Object> configInfoMap = new HashMap<>();

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		BaseProtocolBuilder that = (BaseProtocolBuilder) o;
		return builderId.equals(that.builderId);
	}

	@Override
	public int hashCode() {
		return builderId.hashCode();
	}
}
